<?php
/**
 * The template used for displaying page content in page.php
 *
 * @package WordPress
 * @subpackage Twenty_Eleven
 * @since Twenty Eleven 1.0
 */
?>
<div class="leftpage aleft">
	<?php

		if(has_post_thumbnail()) {the_post_thumbnail('page-thumb');
		} else { ?>
				<img src="<?php echo get_template_directory_uri(); ?>/images/page-thumb.jpg" alt="<?php the_title();?>"/>
	<?php } //endif?>
	<?php //if(function_exists('cpMenu')) cpMenu(array('depth' => 2)); ?>
	<?php if ( get_field('menu_name') ) : ?>
		<?php 
			$args = array(
					'menu'		        => get_field('menu_name'), 
					'container'       	=> false, 
					'menu_class'		=> 'pagemenu'
					);
			echo wp_nav_menu($args); 
		?>
	<?php endif; ?>
</div><!--/.leftpage-->

<div class="centerpage aleft">

	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
		<header class="entry-header">
			<h1 class="entry-title"><?php the_title(); ?></h1>
		</header><!-- .entry-header -->
	
		<div class="entry-content">
			
			<?php 
				
			
				if(get_field('same_content')) { 
						
						$arg = array( 'p'=>get_field('same_content')->ID);
						query_posts($arg);
						while (have_posts()) : the_post();
						the_content();
						endwhile;
						wp_reset_query();


				} else {
					the_content();
			 	} //endif
			?>
			<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
		</div><!-- .entry-content -->
		<div style="clear:both"></div>
		<footer class="entry-meta">
			<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
		</footer><!-- .entry-meta -->
	</article><!-- #post-<?php the_ID(); ?> -->
</div><!--/.centerpage-->
<div class="rightpage aright">
	<?php if(get_field('image_added')) : ?>
		<img class="thumb" src="<?php the_field('image_added'); ?>" alt="pagead of <?php the_title(); ?>" />
	<?php endif; ?>
</div><!--/.rightpage-->